<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ taglib prefix="s" uri="/struts-tags"%>

<script type="text/javascript" src="${ctx}/js/jquery.itextclear.js"></script>
<script type="text/javascript" src="${ctx}/js/global_util.js"></script>
<%@ taglib prefix="s" uri="/struts-tags"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<table class="display" id="example">
	<thead>
		<tr>
			<th>选择</th>
			<th>名称</th>
			<th>所属部门</th>
		</tr>
	</thead>
	<tbody>
		<s:if test="#request.resources==null || #request.resources.size<=0">
			<tr class="gradeA">
				<td colspan="3">暂无数据</td>
			</tr>
		</s:if>
		<s:else>
			<s:iterator var="resource" status="sta" value="#request.resources">
				<s:if test="#sta.even">
					<tr class="gradeA">
				</s:if>
				<s:else>
					<tr class="gradeC">
				</s:else>
				<td><input type="checkbox" name="chk_resource"
					value="${resource.id}" /></td>
				<td><span id="GridView1_ctl04_Label1">${resource.name}</span></td>
				<td><span id="GridView1_ctl04_Label">${resource.organization.fullName}</span></td>
				</tr>
			</s:iterator>
		</s:else>
	</tbody>
</table>
<p>
	<%@ include file="/WEB-INF/pages/common/main_orgtab_pager_train.jsp"%>
</p>
<p align="center">
	<button class="button" type="button" onclick="selectResource()">确定</button>
	<button class="button" type="button" onclick="cancelResource()">取消</button>
</p>

<script type="text/javascript">
	//add.wxn#start
	function cancelResource() {
		closeWindown();
	}
	function selectResource() {
		//var value = $("input:radio[name='select_staff']").val();
		var obj = $("input:checkbox[name='chk_resource'][checked]");
		if(onSelectResource != null){
			onSelectResource($(obj),${planId});
		}
		cancelResource();
	}
	//员工选择翻页处理
	function pageDo(obj) {
		pageHref('${ctx}/${pageUrl}?page=' + obj.value);
	}
	function pageHref(url) {
		url = url + '&${queryString}';
		//如果有搜索的，请将搜索的Form的Id指定为searchForm
		var searchForm = $("#searchForm");
		//alert(searchForm.length);
		//搜索的时候，要同时提交搜索的表单
		if (searchForm != null && searchForm.length > 0) {
			searchForm.attr("action", url);
			searchForm.submit();
		}
		//非搜索时
		else {
			//window.location.href = url;
			pageTo(url);
		}
	}

	function pageTo(url) {
		$.ajax(url, {
			type : "POST",
			data : {
				"operation" : "select"
			},
			dataType : "html",
			cache : false,
			success : function(a) {
				var obj = $("#windown-content");
				obj.html("");
				obj.append(a);
			},
			complete : function() {
			}
		});
	}
	//add.wxn#end

	
</script>